important_time_range = {
    "20191104": "20-20.5",
    "20191108": "13.45-13.5",
}


def get_time_range(trading_date_str, time_range_str):
  if time_range_str == "auto":
    return important_time_range.get(trading_date_str, "0-24")
  else:
    return time_range_str


exchange_assigned_feed_colo = {
    "Okex": "feed-best.cn-hongkong.aliyun",
    "Huobi": "feed-best.ap-northeast-1.aws",
    "Bitflyer": "feed-best.ap-northeast-1.aws",
    "Bitmex": "feed-best.eu-west-1.aws"
}


def get_feed_machine(*, exchange=None, order_machine=None):
  if order_machine is not None:
    if order_machine.find("ap-northeast-1") >= 0:
      return "feed-05.ap-northeast-1.aws"
    elif order_machine.find("aliyun") >= 0:
      return "feed-05.cn-hongkong.aliyun"
    elif order_machine.find("eu-west") >= 0:
      return "feed-02.eu-west-1.aws"
    elif order_machine.find("us-east") >= 0:
      return "feed-02.us-east-1.aws"
  elif exchange is not None:
    return exchange_assigned_feed_colo.get(exchange, "feed-best.ap-northeast-1.aws")
  return "feed-best.ap-northeast-1.aws"
